
#include "../scheduler/process.h"

#include "MyMethod.h"

#include "../scheduler/scheduler.h"
#include "tbb/task_scheduler_init.h"

#include "boost/concept/assert.hpp"
#include "boost/concept_check.hpp"

#include <iostream>
#include <sstream>
#include <string>

inline std::string intToStr(int i){
	std::stringstream s;
	s << i;
	return s.str();
}

#define N 2
#define THRESHOLD 5

int main(int argc, char** argv){

	::tbb::task_scheduler_init init(::tbb::task_scheduler_init::default_num_threads());

	::std::cout << "Hello!" << ::std::endl;
	::pilot::scheduler s;

	::pilot::event e1,e2;
	s.register_event(&e1);
	s.register_event(&e2);

	MyMethod** m = new MyMethod*[N];

	std::string labels[10] = {"~","#","^","&",".","%"};


	for (size_t i=0; i<N; i++)
		m[i] = new MyMethod(&s, 10,"Alice",labels[i%10],THRESHOLD);

	for(size_t i=0; i<N; i++)
		s.submit(m[i]);

	s.start();

	::std::cout << s.seconds_elapsed() << ::std::endl;
	::std::cout << "Bye!" << ::std::endl;

	return 0;
}
